<?php
/**
 * This file is part of Hyperf Mall.
 *
 * @link     https://gitee.com/scwlkj/hyperf_mall
 * @contact  hyperf_mall@163.com
 */

namespace App\JsonRpc;

use App\Repository\GoodsCollectRepository;
use Hyperf\RpcServer\Annotation\RpcService;
use App\JsonRpc\Interfaces\GoodsCollectServiceInterface;

/**
 * @RpcService(name="Goods::GoodsCollectService", protocol="jsonrpc", server="jsonrpc")
 */
class GoodsCollectService extends BaseService implements GoodsCollectServiceInterface
{
    public function init()
    {
        $this->repository = GoodsCollectRepository::getInstance();
    }

    /**
     * Notes: 添加/移除 收藏
     * Author: Bruce.z
     * DateTime: 2022/7/18 9:49
     * @param int $goods_id
     * @param int $member_id
     * @return bool
     */
    public function collect(int $goods_id, int $member_id):bool
    {
        return $this->repository->collect($goods_id,$member_id );
    }

    /**
     * Notes: 会员中心 - 我的收藏
     * Author: Bruce.z
     * DateTime: 2022/7/18 10:19
     * @param int $member_id
     * @param int $page
     * @param int $size
     * @return array
     */
    public function memberCollect(int $member_id, int $page, int $size):array
    {
        return $this->repository->memberCollect($member_id, $page, $size);
    }
}
